- /* sdmpsrnd.cpp by K.Tsuru */
- // function ID = 343 DRADIX, BRADIX
- /********************************************************************************
- SDouble and SDecimal class
- It provides the Boolean value whether it is possible to round off or not.
- Counting from the last position of effective figures, if it conatins "n9or0" over
- (radix-1)'s or zeros, it returns 'true' else 'false'.
- 0.1233 9999 9999 9999 ..... 9999 9875 4578 or
- 0.1234 0000 0000 0000 ..... 0000 0000 0001
- is rounded off,it becomes 0.1234.
- Perhaps it may set "n9or0" as two or three figures.
- **********************************************************************************/
- #ifndef SN_H
- #include "sn.h"
- #endif
- bool SDouble::IsPossibleToRound(uint n9or0) const {
- uint ef = EffFig();
- if(!n9or0 || (n9or0 > ef) || (aHead < ef) ) return false;
- if(!Sign(343)) return true;
- fType rdx_1 = Radix() -1;
- uint j = 0;
- bool cr = false;
-
- if(figure(ef) == rdx_1){
- while( (figure(ef--) == rdx_1) && (j < n9or0) ) j++;
- if(j == n9or0) cr = true;
- } else if(figure(ef) == 0){
- while( (figure(ef--) == 0) && (j < n9or0) ) j++;
- if(j == n9or0) cr = true;
- }
- return cr;
- }
sdmpsrnd.cpp : last modifiled at 2017/03/13 14:31:57(1,169 bytes)
created at 2017/10/07 10:21:15
The creation time of this html file is 2017/10/07 10:30:03 (Sat Oct 07 10:30:03 2017).